namespace Admin2025.Application.Common;

public class ApiResult
{
  public int Code { get; set; } // 0成功，否则失败
  public string Message { get; set; } = "";
  public object? Data { get; set; }

  public static ApiResult Success(object? data = null, string? message = null)
  {
    return new ApiResult { Code = 1000, Message = message ?? "操作成功", Data = data };
  }

  public static ApiResult Fail(int code, string message)
  {
    return new ApiResult { Code = code, Message = message };
  }
}